<template>
  <div class="close-header">
    <div class="slot-bar" v-if="showSlot">
      <slot></slot>
    </div>
    <div class="title-bar" v-else>
      <div class="back-btn" @click="$router.back()">
        <i class="el-icon-back"/>
      </div>
      <div class="title">
        {{title}}
      </div>
    </div>
    <div class="close-btn" @click="$router.back()">
      <i class="el-icon-close"/>
    </div>
  </div>
</template>

<script>
export default {
  name: "close-header",
  props: {
    title: {
      type: String
    },
    showSlot:{
      type: Boolean,
      default: false
    }
  }
}
</script>

<style scoped lang="less">
.close-header {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #E8E8E8;
  color: #606266;
  .title-bar {
    flex: 1;
    display: flex;
    .back-btn {
      font-size: 20px;
      width: 50px;
      height: 50px;
      text-align: center;
      line-height: 50px;
      cursor: pointer;
      &:hover {
        color: #0091ff;
      }
    }
    .title {
      line-height: 50px;
    }
  }
  .slot-bar {
    flex: 1;
  }
  .close-btn {
    font-size: 20px;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
    &:hover {
      color: #0091ff;
    }
  }
}
</style>
